home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / wdj0797.zip / TUFFS.ZIP / EXCEPT3.CPP < prev    next >
C/C++ Source or Header  |  1997-04-24  |  604b  |  25 lines

  1. #include <iostream.h>
  2. #include <except.h>
  3. #include <cstring.h>
  4.  
  5. void badFunction(){
  6.   char* p = 0;
  7.   cout << "The character at " << p << " is " << *p << endl;
  8. }
  9. int main(){
  10.   try  {
  11.     try    {
  12.       cout << "Calling badFunction()" << endl;
  13.       badFunction();
  14.       cout << "badFunction() completed, no exception" << endl;
  15.     } catch (xmsg &x) {
  16.       cerr << "Exception caught '" << x.why() << "'" << endl;
  17.     } catch (...) {
  18.       cerr << "Unknown exception caught" << endl;
  19.     }
  20.   } __except (1) {
  21.     cerr << "Unknown system exception caught" << endl;
  22.   }
  23.   return 0;
  24. }
  25.